import { Ast } from "../ast";
import { RedOpenContext, RedOpenVisitor } from "./RedOpen";

export class RedOpenWaitVisitor extends RedOpenVisitor {
    visitImageView(node: Ast, ctx: RedOpenContext) {
        if (node.id.endsWith(`close_view`) && node.clickable) {
            ctx.close = () => node.click()
        }
    }
    visitTextView(node: Ast, ctx: RedOpenContext) {
        if (node.id.endsWith(`live_condition_leee_button_text`) && node.visibleToUser) {
            if (/.*?后开奖/.test(node.text)) {
                ctx.status = 'opening';
                ctx.hasWait = true;
                return;
            }
        }
    }
}